# 学生类 继承用户类且有自己专有属性班级className
from entity.User import User

class Student(User):
    def __init__(self, studentNum, className):
        self._studentNum = studentNum
        self._className = className

    @property
    def studentNum(self):
        return self._studentNum

    @studentNum.setter
    def studentNum(self, value):
        if not isinstance(value, str):
            raise ValueError("学号必须是字符串")
        self._studentNum = value

    @property
    def className(self):
        return self._className

    @className.setter
    def className(self, value):
        if not isinstance(value, str):
            raise ValueError("班级必须是字符串")
        self._className = value

    # 重写父类方法
    def toString(self):
        return "用户姓名:" + self.name + '\n用户性别:' + self.sex + '\n用户年龄:' + self.age + '\n用户电话:' + self.phone + '\n用户地址:' + self.address + '\n学生班级' + self.className

# st = Student(object)
# st.className = 1
# print(st.className)
